/**
 * 
 */
package com.firebird.oms.web.dwr.sm;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.firebird.base.domain.KeyLabel;
import com.firebird.base.domain.Page;
import com.firebird.oms.domain.sm.TismStaticType;
import com.firebird.oms.domain.sm.TismStaticValue;
import com.firebird.oms.service.sm.StaticService;
import com.firebird.oms.web.base.BaseDwr;

/**
 * @author qiuxj
 * @date 2009-12-4
 *
 */
public class StaticDwr extends BaseDwr {
	
	private StaticService staticService;
	
	/**
	 * 创建静态类型
	 * @param smStaticType
	 */
	public void createStaticType(TismStaticType smStaticType){
		staticService.createStaticType(smStaticType);
	}

	/**
	 * 获取静态类型
	 * @param smStaticType
	 */
	public TismStaticType getStaticType(Integer staticTypeId){
		return staticService.getStaticType(staticTypeId);
	}

	/**
	 * 更新静态类型
	 * @param smStaticType
	 */
	public void updateStaticType(TismStaticType smStaticType){
		staticService.updateStaticType(smStaticType);
	}

	/**
	 * 查询静态类型列表
	 * @param filter
	 * @return
	 */
	public List<TismStaticType> findStaticType(
			Map<String, String> filter){
		return staticService.findStaticType(filter);
	}

	/**
	 * 分页查询静态类型
	 * @param filter
	 * @param like
	 * @param sort
	 * @param pageNo
	 * @param pageSize
	 * @return
	 */
	public Page pageStaticType(Map<String, String> filter,
			Map<String, String> like, Map<String, String> sort, int pageNo,
			int pageSize){
		return staticService.pageStaticType(filter, like, sort, pageNo, pageSize);
	}

	/**
	 * 创建静态值
	 * @param smStaticValue
	 */
	public void createStaticValue(TismStaticValue smStaticValue){
		staticService.createStaticValue(smStaticValue);
	}

	/**
	 * 获取静态值
	 * @param id
	 * @return
	 */
	public TismStaticValue getStaticValue(Integer id){
		return staticService.getStaticValue(id);
	}

	/**
	 * 更新静态值
	 * @param smStaticValue
	 */
	public void updateStaticValue(TismStaticValue smStaticValue){
		staticService.updateStaticValue(smStaticValue);
	}

	/**
	 * 查询静态值列表
	 * @param filter
	 * @return
	 */
	public List<TismStaticValue> findStaticValue(
			Map<String, String> filter){
		return staticService.findStaticValue(filter);
	}

	/**
	 * 分页查询静态值
	 * @param filter
	 * @param like
	 * @param sort
	 * @param pageNo
	 * @param pageSize
	 * @return
	 */
	public Page pageStaticValue(Map<String, String> filter,
			Map<String, String> like, Map<String, String> sort, int pageNo,
			int pageSize){
		return staticService.pageStaticValue(filter, like, sort, pageNo, pageSize);
	}
	
	/**
	 * 获取静态值KLS
	 * @param filter
	 * @return
	 */
	public List<KeyLabel> getStaticValueKls(Map<String, String> filter) {
		List<TismStaticValue> values = this.findStaticValue(filter);
		
		List<KeyLabel> kls = new ArrayList<KeyLabel>();
		for(TismStaticValue value : values){
			kls.add(new KeyLabel(value.getStaticValue().toString(), value.getStaticDesc()));
		}
		return kls;
	}

	public void setStaticService(StaticService staticService) {
		this.staticService = staticService;
	}

}
